<?php


namespace app\common\service;


use think\Db;

/**
 * 写语音播报信息到表中
 */
class SendVoiceMsgService {


    /**
     * 添加商品语音播报信息
     */
    public static function addGoodsVoice($room_id,$goods_id,$order_info){
        $room_info = Db::name('qt_room')->where('id', $room_id)->find();
        $goods_info = Db::name('qt_goods')->where('id', $goods_id)->find();
        $text = '房间  ' . $room_info['room_name'] . '    ' . $goods_info['goods_name'] . '    数量   ' . $order_info['goods_num'];
        Db::name('qt_send_voice_msg')->insert(['content' => $text, 'type' => 1,'create_time'=>time(),'voice_type'=>1]);
    }


    /**
     * 删除商品语音播报信息
     */
    public static function delGoodsVoice($room_id,$engineer_id,$goods_name){
    }

    /**
     * 添加项目语音播报信息
     */
    public static function addProjectVoice(){

    }


    /**
     * 删除项目语音播报信息
     * @param $room_id      房间ID
     * @param $engineer_id  技师ID
     * @param $project_name 项目名称
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function delProjectVoice($room_id,$engineer_id,$project_name){
        $room_name = Db::name('qt_room')->where('id', $room_id)->value('name');
        $engineer_data = Db::name('qt_users')->where('id',$engineer_id)->find();
        $text = $engineer_data['work_number'].'号  ' . $room_name . '  ' . $project_name . ' 取消';
        Db::name('qt_send_voice_msg')->insert(['content' => $text, 'type' => 2,'create_time'=>time(),'voice_type'=>2]);
    }


}